<template>
  <div class="home">
    <el-container>
      <el-header id="header">
        <el-menu
          class="el-menu-demo"
          mode="horizontal"
          default-active="1"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <el-menu-item index="1">安全运维平台</el-menu-item>
           <el-submenu index="2" style="position:fixed; top:0%; right:2%;">
            <template slot="title">欢迎你！{{username}}</template>
            <router-link to="/"><el-menu-item index="2-1" >退出</el-menu-item></router-link>
            
          </el-submenu>
        </el-menu>
      </el-header>
      <el-aside width="200px">
        <!-- router true开启路由跳转 -->
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          :router="true"
          style="height: 600px"
        >
          <!-- index表示跳转的地址 -->
          <el-menu-item index="/user">
            <template slot="title">
              <i class="el-icon-s-home"></i>
              <span>首页</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/user">
            <template slot="title">
              <i class="el-icon-user-solid"></i>
              <span>用户管理</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/resources">
            <template slot="title">
              <i class="el-icon-suitcase"></i>
              <span>服务器资源管理</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/loophole">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>漏洞资源管理</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/notice">
            <template slot="title">
              <i class="el-icon-data-board"></i>
              <span>我的任务</span>
            </template>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main
        style="text-align:left;margin-left: 200px;margin-top: -600px;"
      >
        <router-view></router-view>
      </el-main>
    </el-container>
  </div>
</template>

 <script>
 export default {
    data() {
      return {
        username:''
      }
    },
    created() {
    // 给username输入用户名
    this.username=sessionStorage.getItem('mytoken');
  },
  }
 </script>

<style>
.el-header {
  padding: 0 !important;
  margin: 0 !important;
}
</style>